package com.cn.qtms.controller;//类注释设置模板

import com.cn.qtms.base.controller.BaseController;
import com.cn.qtms.base.service.BaseService;
import com.cn.qtms.common.result.Result;
import com.cn.qtms.common.result.ResultUtil;
import com.cn.qtms.entity.TmSecKill;
import com.cn.qtms.service.TmSecKillService;
import com.cn.qtms.vo.SecKillVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Name:TmSecKillController
 * @Description:
 * @Author: zhangyang
 * @Date: 2019-12-25 19:26
 **/
@RestController
@RequestMapping("sec-kill")
public class TmSecKillController extends BaseController<TmSecKill,Long> {
    @Autowired
    private TmSecKillService service;
    @Override
    protected BaseService<TmSecKill, Long> getService() {
        return service;
    }

    @PostMapping("createSecKills")
    public Result createSecKills(){
        service.createSecKills();
        return ResultUtil.success();
    }

    @PostMapping("excuteSecKill")
    public Result<SecKillVo> excuteSecKill(@RequestBody SecKillVo vo ){
        return ResultUtil.success(service.excuteSecKill(vo));
    }
}
